home *** CD-ROM | disk | FTP | other *** search
- --------------------------------------------------------------------------------
- -- Weapon Pick
- -- Original Carnage Contest Weapon
- -- Script by DC, August 2009, www.UnrealSoftware.de
- --------------------------------------------------------------------------------
-
- -- Setup Tables
- if cc==nil then cc={} end
- cc.pick={}
-
- -- Load & Prepare Ressources
- cc.pick.gfx_wpn=loadgfx("weapons/pick.bmp") -- Weapon Image
- setmidhandle(cc.pick.gfx_wpn)
- cc.pick.sfx_attack=loadsfx("swish.ogg") -- Attack Sound
- cc.pick.sfx_hitground=loadsfx("crumble.ogg") -- Hit Ground Sound
-
- --------------------------------------------------------------------------------
- -- Weapon: Pick
- --------------------------------------------------------------------------------
-
- cc.pick.id=addweapon("cc.pick","Pick",cc.pick.gfx_wpn) -- Add Weapon
- cc.pick.ammo=3 -- 3 Digs
-
- function cc.pick.draw() -- Draw
- -- Draw
- if getplayeraction(0)==0 then
- setblend(blend_alpha)
- setalpha(1)
- setcolor(255,255,255)
- setscale(-getplayerdirection(0),1)
- setrotation(getplayerrotation(0)-(30-(weapon_timer*3))*(getplayerdirection(0)))
- drawimage(cc.pick.gfx_wpn,getplayerx(0)+getplayerdirection(0)*7,getplayery(0)+3)
- end
- -- HUD ammobar
- if cc.pick.ammo-weapon_shots>0 then
- hudammobar(cc.pick.ammo-weapon_shots,cc.pick.ammo)
- end
- -- HUD Crosshair
- if cc.pick.ammo-weapon_shots>0 then
- hudcrosshair(7,3)
- end
- end
-
- function cc.pick.attack(attack) -- Attack
- -- Timer
- if weapon_timer>0 then
- weapon_timer=weapon_timer-1
- end
- if (weapon_shots<cc.pick.ammo) and (weapon_timer<=0) then
- if (attack==1) then
- -- No more weapon switching!
- useweapon(0)
- playsound(cc.pick.sfx_attack)
- weapon_shots=weapon_shots+1
- weapon_timer=22
- -- Collision
- if collision(col20x20,getplayerx(0)+getplayerdirection(0)*21,getplayery(0),1,1)==1 then
- if playercollision()~=0 and playercollision()~=playercurrent() then
- playerpush(playercollision(),getplayerdirection(0)*2,-1)
- playerdamage(playercollision(),10)
- playsound(sfx_splatter1)
- end
- if terraincollision()==1 then
- playsound(cc.pick.sfx_hitground)
- end
- end
- -- Free Terrain
- terrainexplosion(getplayerx(0)+getplayerdirection(0)*7+math.sin(math.rad(getplayerrotation(0)))*1,getplayery(0)-1-math.cos(math.rad(getplayerrotation(0)))*3,15,2)
- terrainexplosion(getplayerx(0)+getplayerdirection(0)*7+math.sin(math.rad(getplayerrotation(0)))*10,getplayery(0)-1-math.cos(math.rad(getplayerrotation(0)))*10,15,2)
- -- End Turn
- if weapon_shots>=cc.pick.ammo then
- endturn()
- end
- end
- end
- end
-